export type CheckItemType = 'risk' | 'guarantee';

export interface CheckItemTemplate {
  id: string;
  title: string;
  description: string;
  guide: string;
  compliance_type: CheckItemType;
  maturity_level?: number; // 成熟度等级（1-5）
}

export type AssessmentType = '101' | '102' | '103' | '104' | '105';

export interface TemplateTable {
  id: string;
  name: string;
  description: string;
  assessment_type: AssessmentType;
  items: CheckItemTemplate[];
  default_maturity_level?: number; // 默认成熟度等级（仅用于105评估类型）
}

export interface ImportStats {
  total: number;
  success: number;
  failed: number;
}

export interface ImportResult {
  success: boolean;
  message: string;
  stats: ImportStats;
}

export interface TemplateImportState {
  currentTemplate: TemplateTable | null;
  importProgress: number;
  isImporting: boolean;
  importStats: ImportStats;
  importResult?: ImportResult;
}

export interface CreateTemplateParams {
  name: string;
  description: string;
  assessmentType: AssessmentType;
  items: Omit<CheckItemTemplate, 'id'>[];
  defaultMaturityLevel?: number;
}

// Helper function to get assessment type display text
const assessmentTypeDisplayMap: Record<AssessmentType, string> = {
  '101': '互联网新技术新业务安全评估',
  '102': '新业务涉诈风险安全评估',
  '103': '智慧中台评估',
  '104': '5G应用安全评估',
  '105': '数据安全评估',
};

export function getAssessmentTypeDisplay(type: AssessmentType): string {
  return assessmentTypeDisplayMap[type];
}
